//==================================================================
//  Copyright (C) 2006  Davide Pasca
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
//==================================================================
/// @file m5d_light.h
///
/// Light-source class.
///
//==================================================================

#ifndef M5D_LIGHT_H
#define M5D_LIGHT_H

#include "m5d_types.h"
#include "m5d_model.h"

//==================================================================
namespace M5D {

//==================================================================
class Light : public Model
{
public:
	enum Type
	{
		LIGHT_TYPE_DIR,
		LIGHT_TYPE_N,
	};

private:
	Type			_type;
	PMath::Vector3	_box_min, _box_max;
	PMath::Vector4	_pos;
	PMath::Vector3	_col;

private:
	//--------------------------------------------------------------
	Light( Scene *scenep, const char *namep=NULL, Light *copy_fromp=NULL );

public:
	~Light();

	void SetType( Type type )
	{
		_type = type;
	}

	void SetLocalPos( const PMath::Vector4 &pos )
	{
		_pos = pos;
	}

	const PMath::Vector4 &GetLocalPos() const
	{
		return _pos;
	}

	const PMath::Vector4 CalcGlobalPos() const;

	void SetColor( const PMath::Vector3 &col )	{	_col = col;		}
	const PMath::Vector3 &GetColor() const		{	return _col;	}

	friend class	Model;
	friend class	Scene;
};

//==================================================================

};

#endif